package com.lk.spring.boot.sample.config;

import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * 配置mapperScannerConfigurer 
* <p>Title:MyBatisMapperScannerConfig </p>
* <p>Description: </p>
* <p>Company: </p> 
* @author kexl
* @date 上午10:54:43
 */
@Configuration
@AutoConfigureAfter(MybatisConfig.class)//让此类在上一个类加载完毕后再加载
public class MyBatisMapperScannerConfig {

	@Bean
	public MapperScannerConfigurer mapperScannerConfigurer(){
		MapperScannerConfigurer mapperScannerConfigurer=new MapperScannerConfigurer();
		mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
		mapperScannerConfigurer.setBasePackage("com.lk.spring.boot.sample.dao");
		mapperScannerConfigurer.setAnnotationClass(Mapper.class);
		return mapperScannerConfigurer;
	}
}
